﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algorithm.Easy_110_IsBalanced
{
    public class TreeNode
    {
        public int val;
        public TreeNode left;
        public TreeNode right;
        public TreeNode(int val = 0, TreeNode left = null, TreeNode right = null)
        {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }
    class MainProject
    {
        static void Main(string[] args)
        {
            //TreeNode treeNode = new TreeNode(1, new TreeNode(2, new TreeNode(3, new TreeNode(4, new TreeNode(5)))));
            TreeNode treeNode = new TreeNode(1, new TreeNode(2, new TreeNode(3, new TreeNode(4), new TreeNode(4)), new TreeNode(3)), new TreeNode(2));
            //Console.WriteLine(IsBalanced(treeNode));
            Console.ReadKey();
        }

        //public static bool IsBalanced(TreeNode root)
        //{
        //    int leftHeight = 0;
        //    int rightHeight = 0;
        //    return GetTreeHeight(root, ref leftHeight, ref rightHeight);
        //}

        //public static bool GetTreeHeight(TreeNode treeNode, int leftCount, int rightCount)
        //{
        //    if (treeNode.left)
        //    {

        //    }


        //    //if (Math.Abs(leftCount - rightCount) > 1)
        //    //{
        //    //    return false;
        //    //}

        //    //if (treeNode.left == null && treeNode.right == null)
        //    //{
        //    //    rightCount++;
        //    //    leftCount++;
        //    //}
        //    //else if (treeNode.left == null && treeNode.right != null)
        //    //{
        //    //    rightCount++;
        //    //    return GetTreeHeight(treeNode.right, leftCount, rightCount);
        //    //}
        //    //else if (treeNode.left != null && treeNode.right == null)
        //    //{
        //    //    leftCount++;
        //    //    return GetTreeHeight(treeNode.left, leftCount, rightCount);
        //    //}
        //    //else
        //    //{
        //    //    leftCount = 0;
        //    //    rightCount = 0;
        //    //    return GetTreeHeight(treeNode.left, leftCount, rightCount) && GetTreeHeight(treeNode.right, leftCount, rightCount);
        //    //}
        //    //return true;
        //}
    }
}
